﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Models;
using PetaPoco;

namespace DAL.MySQL
{
    public class xbodyDAL
    {
        public Database db = DbScoure.DataBase();
        public xbodyEntity GetOne(int id)
        {
            return db.SingleOrDefault<xbodyEntity>("select * from xbody where xid=@0", id);
        }
        public xinxiEntity Save(xinxiEntity model)
        {
            db.Save("xbody", "ID", model);
            return model;
        }

        public bool Del(int id)
        {
            try
            {
                db.Execute("delete from xbody where xid=@0", id);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
        public bool Del(xinxiEntity model)
        {
            try
            {
                db.Delete("xbody", "ID", model);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
    }
}
